<?php 
/*********************************************************
This file provides a list of available MO batches to send
to the bank blinded
*********************************************************/

/*********************************************************
includes
*********************************************************/
require_once 'config.inc';
require_once '_common.inc';
require_once '_customer.inc';
require_once '_db.inc';
require_once '_rsa.inc';
require_once '_ui.inc';


/*********************************************************
connect to db
*********************************************************/
$customer_conn = db_connect(CUSTOMER_DB_USER, CUSTOMER_DB_PASSWORD);

/*********************************************************
get available mo batches for merchant
*********************************************************/

$sql = "select uniqueness_string as us, val, bank_sig from mo_detail_customer where spent = 0 and bank_sig != ' ' order by us";

$mo_arr = db_do_query($customer_conn, $sql);

/*********************************************************
close db connection
*********************************************************/
oci_close($customer_conn);

?>
<HTML>

<HEAD>
	<title>Give Money Order to Merchant</title>
</HEAD>
<BODY>
<?php
ui_print_header('Customer - Select Money Order to Spend');
echo <<<END
<FORM action="4R_2_MerchantChoseSelectorString.php" method="post">
	<TABLE border="0">
	<tr><td width="190">Select Money Order to Spend:</td>
	<td width="20">:</td>
	<td>
END;

$mobatch = "test";
echo "<select name=\"selectedmo\">\n";

foreach($mo_arr as $mo_avail) {
	$us = $mo_avail[US];
	$value = $mo_avail[VAL];
	$sign = $mo_avail[BANK_SIG];
	echo "<option value=\"" . $us . ":" . $value . "+" . $sign . "\">$us &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\$$value </option>\n";
}

echo "</select>";

echo <<<END
	<TR>
		<TD colspan="2" align="center">
			<input type="submit" value="Give Money Order Information to Merchant">
		</TD>
		</TR>
	</TABLE>
</FORM>
END;

ui_print_footer(date('Y-m-d H:i:s'));
?>
</BODY>
</HTML>